const fs = require("fs");
const path = require("path");
function registerRoutes(app) {
    // 1.获取modules下的所有文件
    const files = fs.readdirSync(path.join(__dirname, "/modules"));
    // 2.遍历文件
    for (const file of files) {
        if (!file.endsWith(".router.js")) continue;
        const router = require(`./modules/${file}`);
        app.use(router.routes());
        app.use(router.allowedMethods());
    }
}

module.exports = registerRoutes;
